Visualizations in wb_view

library(plyr)
library(psych)
library(ggplot2)
library(Hmisc)
library(stats)
library(lm.beta)
library(lmtest)
library(ggpubr)
library(dotwhisker)
library(boot)
library(knitr)
library(kableExtra)
library(ggdag)
library(mosaic)
library(mets)
library(xtable)
library(stargazer)
library(yhat)
library(tidyverse)
library(broom)
library(lmSupport)
#devtools::install_github("malcolmbarrett/ggdag")
#devtools::install_github("kkholst/lava")  
#devtools::install_github("kkholst/mets")  
cbPalette <- c("#CC79A7", "#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00")
bwPalette<-c("#000000", "#999999", "CCCCCC","666666","333333")

Loading datasets and combining

##    Mode   FALSE    TRUE 
## logical     510     117
## [1] 1003  225

The missing check is OK. Lines up with imaging data.

summary(d4$Age_in_Yrs)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   22.00   27.00   30.00   29.52   32.00   36.00
sd(d4$Age_in_Yrs)
## [1] 3.611612
summary(d4$Menstrual_AgeBegan)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##    8.00   12.00   13.00   12.72   13.00   18.00
sd(d4$Menstrual_AgeBegan)
## [1] 1.580688
d4$Race <- relevel(d4$Race, "White")

dem1<-lm(Menstrual_AgeBegan ~ Race, data=d4)
summary(dem1)
## 
## Call:
## lm(formula = Menstrual_AgeBegan ~ Race, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4.8218 -0.8218  0.1782  0.6667  5.1782 
## 
## Coefficients:
##                                          Estimate Std. Error t value
## (Intercept)                              12.82181    0.08086 158.566
## RaceAm. Indian/Alaskan Nat.               3.17819    1.57003   2.024
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -0.48848    0.28467  -1.716
## RaceBlack or African Am.                 -0.47565    0.19508  -2.438
## RaceMore than one                         0.09486    0.45979   0.206
## RaceUnknown or Not Reported              -0.52181    0.50238  -1.039
##                                          Pr(>|t|)    
## (Intercept)                                <2e-16 ***
## RaceAm. Indian/Alaskan Nat.                0.0435 *  
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   0.0868 .  
## RaceBlack or African Am.                   0.0151 *  
## RaceMore than one                          0.8366    
## RaceUnknown or Not Reported                0.2995    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.568 on 504 degrees of freedom
## Multiple R-squared:  0.02572,    Adjusted R-squared:  0.01605 
## F-statistic: 2.661 on 5 and 504 DF,  p-value: 0.02183
lm.beta(dem1)
## 
## Call:
## lm(formula = Menstrual_AgeBegan ~ Race, data = d4)
## 
## Standardized Coefficients::
##                              (Intercept) 
##                              0.000000000 
##              RaceAm. Indian/Alaskan Nat. 
##                              0.089032549 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                             -0.076097171 
##                 RaceBlack or African Am. 
##                             -0.108415353 
##                        RaceMore than one 
##                              0.009105207 
##              RaceUnknown or Not Reported 
##                             -0.045814823
dem2<-lm(BMI ~ Race, data=d4)
summary(dem2)
## 
## Call:
## lm(formula = BMI ~ Race, data = d4)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.2779  -3.9839  -0.8598   2.3667  19.0983 
## 
## Coefficients:
##                                          Estimate Std. Error t value
## (Intercept)                               25.6017     0.2772  92.351
## RaceAm. Indian/Alaskan Nat.                3.6283     5.3827   0.674
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  -3.9808     0.9760  -4.079
## RaceBlack or African Am.                   3.5162     0.6688   5.257
## RaceMore than one                         -0.4475     1.5764  -0.284
## RaceUnknown or Not Reported                2.9273     1.7224   1.700
##                                          Pr(>|t|)    
## (Intercept)                               < 2e-16 ***
## RaceAm. Indian/Alaskan Nat.                0.5006    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 5.26e-05 ***
## RaceBlack or African Am.                 2.16e-07 ***
## RaceMore than one                          0.7766    
## RaceUnknown or Not Reported                0.0898 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 5.376 on 504 degrees of freedom
## Multiple R-squared:  0.09516,    Adjusted R-squared:  0.08618 
## F-statistic:  10.6 on 5 and 504 DF,  p-value: 1.071e-09
lm.beta(dem2)
## 
## Call:
## lm(formula = BMI ~ Race, data = d4)
## 
## Standardized Coefficients::
##                              (Intercept) 
##                               0.00000000 
##              RaceAm. Indian/Alaskan Nat. 
##                               0.02857100 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                              -0.17432086 
##                 RaceBlack or African Am. 
##                               0.22528491 
##                        RaceMore than one 
##                              -0.01207526 
##              RaceUnknown or Not Reported 
##                               0.07224628
dem3<-lm(Age_in_Yrs ~ Race, data=d4)
summary(dem3)
## 
## Call:
## lm(formula = Age_in_Yrs ~ Race, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -7.8723 -2.8723  0.1277  3.1277  9.0303 
## 
## Coefficients:
##                                          Estimate Std. Error t value
## (Intercept)                               29.8723     0.1808 165.248
## RaceAm. Indian/Alaskan Nat.                5.1277     3.5100   1.461
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  -2.9026     0.6364  -4.561
## RaceBlack or African Am.                  -0.3339     0.4361  -0.766
## RaceMore than one                         -3.7057     1.0279  -3.605
## RaceUnknown or Not Reported               -1.7723     1.1231  -1.578
##                                          Pr(>|t|)    
## (Intercept)                               < 2e-16 ***
## RaceAm. Indian/Alaskan Nat.              0.144672    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  6.4e-06 ***
## RaceBlack or African Am.                 0.444302    
## RaceMore than one                        0.000343 ***
## RaceUnknown or Not Reported              0.115183    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.505 on 504 degrees of freedom
## Multiple R-squared:  0.06725,    Adjusted R-squared:  0.05799 
## F-statistic: 7.267 on 5 and 504 DF,  p-value: 1.379e-06
lm.beta(dem3)
## 
## Call:
## lm(formula = Age_in_Yrs ~ Race, data = d4)
## 
## Standardized Coefficients::
##                              (Intercept) 
##                               0.00000000 
##              RaceAm. Indian/Alaskan Nat. 
##                               0.06286849 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                              -0.19790868 
##                 RaceBlack or African Am. 
##                              -0.03330682 
##                        RaceMore than one 
##                              -0.15567808 
##              RaceUnknown or Not Reported 
##                              -0.06810628

Nice function to make a pretty table

tablr<-function(Y,x,D){
  Q<-favstats(Y ~ x, data = D)
  Q.stat <- Q[, c("x", "n", "mean", "sd")] 
  colnames(Q.stat)<-c("test","n", "mean", "sd")
  a<-match.call()[2]
  return(Q.stat)
}

Making a nice table

demo_vars<-c("Race","BMI","HbA1C","Menstrual_AgeBegan","Age_in_Yrs","group")
dems<-d4[demo_vars]
#dems<-na.omit(dems)
byRace<-apply(dems, MARGIN = 2, FUN = tablr, x=dems$Race, D=dems)
byGroup<-apply(dems, MARGIN = 2, FUN = tablr, x=dems$group, D=dems)
t1<-merge(byRace$BMI,byRace$HbA1C,by="test")
t2<-merge(t1,byRace$Menstrual_AgeBegan,by="test")
t3<-merge(t2, byRace$Age_in_Yrs, by="test")


s1<-merge(byGroup$BMI,byGroup$HbA1C,by="test")
s2<-merge(s1,byGroup$Menstrual_AgeBegan,by="test")
s3<-merge(s2, byGroup$Age_in_Yrs, by="test")


all<-rbind(t3,s3)
row.names(all)<-all$test
row.names(all)<-c("Native American", "Asian, Native Hawaiian, or Pacific Islander","Black or African American","More than one race","Unknown or chose not to report","White","Total")

drops <- c("test")
all<-all[ , !(names(all) %in% drops)]

Make the nice table

kable(all, format = "html",  col.names = c("n","mean","SD",
                                           "n","mean","SD",
                                           "n","mean","SD",
                                           "n","mean","SD"),
      caption = "Table 1: Descriptive statistics by reported race",
      digits = c(0, 2, 2, 0, 2, 2,0, 2, 2,0, 2, 2), align = "ccrr") %>%
  kable_styling(full_width = FALSE, position = "left") %>%
  add_header_above(c(" " = 1,"BMI"= 3,"HbA1C"= 3,"Age of menses onset"=3,"Age at scan"=3))
Table 1: Descriptive statistics by reported race
BMI
HbA1C
Age of menses onset
Age at scan
n mean SD n mean SD n mean SD n mean SD
Native American 1 29.23 NA 1 5.90 NA 1 16.00 NA 1 35.00 NA
Asian, Native Hawaiian, or Pacific Islander 33 21.62 3.62 21 5.23 0.31 33 12.33 1.49 33 26.97 4.29
Black or African American 78 29.12 6.42 44 5.40 0.35 78 12.35 1.84 78 29.54 3.43
More than one race 12 25.15 4.13 8 5.39 0.26 12 12.92 1.51 12 26.17 3.49
Unknown or chose not to report 10 28.53 4.73 8 5.29 0.40 10 12.30 1.83 10 28.10 4.23
White 376 25.60 5.31 245 5.21 0.37 376 12.82 1.51 376 29.87 3.43
Total 510 25.94 5.62 327 5.25 0.37 510 12.72 1.58 510 29.52 3.61

Summary of main findings

Earlier onset of puberty significantly related to heavier adult BMI.

int_graph<-ggplot(d4, aes(Menstrual_AgeBegan, BMI)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm,colour='black')+theme_classic()+scale_y_continuous(name="Body Mass Index (BMI)")+
  scale_x_continuous(name="Age of onset of menstration (years)")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))
int_graph

m1<-lm( BMI ~  Menstrual_AgeBegan, data=d4)
summary(m1)

Call: lm(formula = BMI ~ Menstrual_AgeBegan, data = d4)

Residuals: Min 1Q Median 3Q Max -9.342 -4.033 -1.228 2.652 21.408

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 33.3323 1.9952 16.706 < 2e-16 Menstrual_AgeBegan -0.5817 0.1557 -3.736 0.000209 — Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ‘’ 1

Residual standard error: 5.553 on 508 degrees of freedom Multiple R-squared: 0.02673, Adjusted R-squared: 0.02482 F-statistic: 13.95 on 1 and 508 DF, p-value: 0.0002086

m2<-lm( BMI ~  Menstrual_AgeBegan+Age_in_Yrs, data=d4)
lrtest(m1,m2)

Likelihood ratio test

Model 1: BMI ~ Menstrual_AgeBegan Model 2: BMI ~ Menstrual_AgeBegan + Age_in_Yrs #Df LogLik Df Chisq Pr(>Chisq)
1 3 -1597.0
2 4 -1593.7 1 6.5532 0.01047 * — Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ‘’ 1

summary(m2)

Call: lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs, data = d4)

Residuals: Min 1Q Median 3Q Max -9.960 -3.900 -1.099 2.680 20.616

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 28.44674 2.75285 10.334 < 2e-16 Menstrual_AgeBegan -0.60089 0.15505 -3.875 0.00012 Age_in_Yrs 0.17377 0.06786 2.561 0.01074 *
— Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ‘’ 1

Residual standard error: 5.523 on 507 degrees of freedom Multiple R-squared: 0.03916, Adjusted R-squared: 0.03537 F-statistic: 10.33 on 2 and 507 DF, p-value: 4e-05

m3<-lm( BMI ~  Menstrual_AgeBegan+Age_in_Yrs+Race, data=d4)
lrtest(m2,m3)

Likelihood ratio test

Model 1: BMI ~ Menstrual_AgeBegan + Age_in_Yrs Model 2: BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race #Df LogLik Df Chisq Pr(>Chisq)
1 4 -1593.7
2 9 -1569.9 5 47.673 4.141e-09 *** — Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ‘’ 1

summary(m3)

Call: lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race, data = d4)

Residuals: Min 1Q Median 3Q Max -9.6518 -3.7428 -0.9398 2.2026 19.1630

Coefficients: Estimate Std. Error t value (Intercept) 29.06601 2.76132 10.526 Menstrual_AgeBegan -0.56271 0.15054 -3.738 Age_in_Yrs 0.12556 0.06734 1.865 RaceAm. Indian/Alaskan Nat. 4.77289 5.33583 0.894 RaceAsian/Nat. Hawaiian/Othr Pacific Is. -3.89122 0.98369 -3.956 RaceBlack or African Am. 3.29051 0.66323 4.961 RaceMore than one 0.07111 1.57335 0.045 RaceUnknown or Not Reported 2.85620 1.70302 1.677 Pr(>|t|)
(Intercept) < 2e-16 Menstrual_AgeBegan 0.000207 Age_in_Yrs 0.062825 .
RaceAm. Indian/Alaskan Nat. 0.371484
RaceAsian/Nat. Hawaiian/Othr Pacific Is. 8.73e-05 RaceBlack or African Am. 9.60e-07 RaceMore than one 0.963966
RaceUnknown or Not Reported 0.094138 .
— Signif. codes: 0 ‘’ 0.001 ’’ 0.01 ’’ 0.05 ‘.’ 0.1 ‘’ 1

Residual standard error: 5.297 on 502 degrees of freedom Multiple R-squared: 0.1249, Adjusted R-squared: 0.1127 F-statistic: 10.24 on 7 and 502 DF, p-value: 5.16e-12

lm.beta(m3)

Call: lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race, data = d4)

Standardized Coefficients:: (Intercept) 0.000000000 Menstrual_AgeBegan -0.158175583 Age_in_Yrs 0.080639616 RaceAm. Indian/Alaskan Nat. 0.037584083 RaceAsian/Nat. Hawaiian/Othr Pacific Is. -0.170398293 RaceBlack or African Am. 0.210822093 RaceMore than one 0.001918786 RaceUnknown or Not Reported 0.070491562

effect.size(m3)
          Effect.Size Recommended

Wherry1 0.1109 No Claudy3 0.1131 No Smith 0.111 No Wherry2 0.1127 Yes Olkin & Pratt 0.1113 No Pratt 0.1113 No

modelEffectSizes(m3)

lm(formula = BMI ~ Menstrual_AgeBegan + Age_in_Yrs + Race, data = d4)

Coefficients SSR df pEta-sqr dR-sqr (Intercept) 3108.7777 1 0.1808 NA Menstrual_AgeBegan 392.0226 1 0.0271 0.0244 Age_in_Yrs 97.5466 1 0.0069 0.0061 Race 1380.1302 5 0.0892 0.0857

Sum of squared errors (SSE): 14085.0 Sum of squared total (SST): 16095.4

confint(m3)
                                            2.5 %     97.5 %

(Intercept) 23.640834256 34.4911811 Menstrual_AgeBegan -0.858480753 -0.2669420 Age_in_Yrs -0.006742434 0.2578558 RaceAm. Indian/Alaskan Nat. -5.710422957 15.2562039 RaceAsian/Nat. Hawaiian/Othr Pacific Is. -5.823875848 -1.9585587 RaceBlack or African Am. 1.987456931 4.5935651 RaceMore than one -3.020056287 3.1622851 RaceUnknown or Not Reported -0.489726041 6.2021250

x<-as.data.frame(summary(m3)[4])
row.names(x)<-c("Intercept","Menstrual age began (yrs)","Age (yrs)", "Asian American, Native Hawaiian, Other Pacific Islander", "Black or African American", "More than one race","Unknown race or not reported", "White")
x
##                                                         coefficients.Estimate
## Intercept                                                         29.06600768
## Menstrual age began (yrs)                                         -0.56271138
## Age (yrs)                                                          0.12555668
## Asian American, Native Hawaiian, Other Pacific Islander            4.77289046
## Black or African American                                         -3.89121729
## More than one race                                                 3.29051102
## Unknown race or not reported                                       0.07111442
## White                                                              2.85619947
##                                                         coefficients.Std..Error
## Intercept                                                            2.76132290
## Menstrual age began (yrs)                                            0.15054168
## Age (yrs)                                                            0.06733805
## Asian American, Native Hawaiian, Other Pacific Islander              5.33583189
## Black or African American                                            0.98369101
## More than one race                                                   0.66323283
## Unknown race or not reported                                         1.57335439
## White                                                                1.70302035
##                                                         coefficients.t.value
## Intercept                                                        10.52611693
## Menstrual age began (yrs)                                        -3.73791081
## Age (yrs)                                                         1.86457269
## Asian American, Native Hawaiian, Other Pacific Islander           0.89449791
## Black or African American                                        -3.95573127
## More than one race                                                4.96132112
## Unknown race or not reported                                      0.04519924
## White                                                             1.67713761
##                                                         coefficients.Pr...t..
## Intercept                                                        1.509110e-23
## Menstrual age began (yrs)                                        2.068971e-04
## Age (yrs)                                                        6.282468e-02
## Asian American, Native Hawaiian, Other Pacific Islander          3.714842e-01
## Black or African American                                        8.728419e-05
## More than one race                                               9.601408e-07
## Unknown race or not reported                                     9.639665e-01
## White                                                            9.413808e-02
kable(x, format = "html",  
      caption = "Table 2: Relationship between BMI and Age of onset of menses",
      digits = c(2,2,2,2), align = "cccc", col.names = c("Estimate", "Standard Error","T value","P value")) %>%
  kable_styling()
Table 2: Relationship between BMI and Age of onset of menses
Estimate Standard Error T value P value
Intercept 29.07 2.76 10.53 0.00
Menstrual age began (yrs) -0.56 0.15 -3.74 0.00
Age (yrs) 0.13 0.07 1.86 0.06
Asian American, Native Hawaiian, Other Pacific Islander 4.77 5.34 0.89 0.37
Black or African American -3.89 0.98 -3.96 0.00
More than one race 3.29 0.66 4.96 0.00
Unknown race or not reported 0.07 1.57 0.05 0.96
White 2.86 1.70 1.68 0.09

Summary

Age of menstration is significantly related to adult BMI. This relationship remains significant with the addition of age and race in the model. Both age and race improve the model fit.

Imaging data

img<-read.table("~/Google Drive/HCP_graph/1200/5000perms/p_corrected.csv", sep=",", header=F)
row.names(img)<-c("<BMI",">BMI","<AoM",">AoM","<AoMxBMI",">AoMxBMI")
# head(img)
img_p<-1-img
# head(img_p)
bool<-img_p<0.05
img_p[img_p > 0.05] <- NA

Significant positive BMI

5->7 == V67 5->10 == V70 9->11 == V131 10->13 == V148 14->12 == V207

matrix( as.matrix(img_p[1,1:225]),nrow=15, ncol=15)
##       [,1] [,2] [,3] [,4]  [,5] [,6]  [,7] [,8]  [,9] [,10] [,11] [,12]
##  [1,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##  [2,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##  [3,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##  [4,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##  [5,]   NA   NA   NA   NA    NA   NA 0.003   NA    NA 0.012    NA    NA
##  [6,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##  [7,]   NA   NA   NA   NA 0.003   NA    NA   NA    NA    NA    NA    NA
##  [8,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##  [9,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA 0.003    NA
## [10,]   NA   NA   NA   NA 0.012   NA    NA   NA    NA    NA    NA    NA
## [11,]   NA   NA   NA   NA    NA   NA    NA   NA 0.003    NA    NA    NA
## [12,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
## [13,]   NA   NA   NA   NA    NA   NA    NA   NA    NA 0.002    NA    NA
## [14,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA 0.037
## [15,]   NA   NA   NA   NA    NA   NA    NA   NA    NA    NA    NA    NA
##       [,13] [,14] [,15]
##  [1,]    NA    NA    NA
##  [2,]    NA    NA    NA
##  [3,]    NA    NA    NA
##  [4,]    NA    NA    NA
##  [5,]    NA    NA    NA
##  [6,]    NA    NA    NA
##  [7,]    NA    NA    NA
##  [8,]    NA    NA    NA
##  [9,]    NA    NA    NA
## [10,] 0.002    NA    NA
## [11,]    NA    NA    NA
## [12,]    NA 0.037    NA
## [13,]    NA    NA    NA
## [14,]    NA    NA    NA
## [15,]    NA    NA    NA
p1<-ggplot(d4, aes(BMI, V67)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="5 and 7")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p2<-ggplot(d4, aes(BMI, V70)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="5 and 10")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p3<-ggplot(d4, aes(BMI, V131)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="9 and 11")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p4<-ggplot(d4, aes(BMI, V148)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="10 and 13")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

ggarrange(p1,p2,p3,p4 + rremove("x.text"), 
          labels = c("A", "B", "C","D"),
          ncol = 2, nrow = 2)

Significant negative BMI

1->6 == V6 3->4 == V34 4->8 == V53 4->15 == V60 10->12 == V147 10->15 == V150

matrix( as.matrix(img_p[2,1:225]),nrow=15, ncol=15)
##        [,1] [,2]  [,3]  [,4] [,5]  [,6] [,7]  [,8] [,9] [,10] [,11] [,12]
##  [1,]    NA   NA    NA    NA   NA 0.044   NA    NA   NA    NA    NA    NA
##  [2,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
##  [3,]    NA   NA    NA 0.046   NA    NA   NA    NA   NA    NA    NA    NA
##  [4,]    NA   NA 0.046    NA   NA    NA   NA 0.016   NA    NA    NA    NA
##  [5,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
##  [6,] 0.044   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
##  [7,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
##  [8,]    NA   NA    NA 0.016   NA    NA   NA    NA   NA    NA    NA    NA
##  [9,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
## [10,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA 0.006
## [11,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
## [12,]    NA   NA    NA    NA   NA    NA   NA    NA   NA 0.006    NA    NA
## [13,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
## [14,]    NA   NA    NA    NA   NA    NA   NA    NA   NA    NA    NA    NA
## [15,]    NA   NA    NA 0.002   NA    NA   NA    NA   NA 0.014    NA    NA
##       [,13] [,14] [,15]
##  [1,]    NA    NA    NA
##  [2,]    NA    NA    NA
##  [3,]    NA    NA    NA
##  [4,]    NA    NA 0.002
##  [5,]    NA    NA    NA
##  [6,]    NA    NA    NA
##  [7,]    NA    NA    NA
##  [8,]    NA    NA    NA
##  [9,]    NA    NA    NA
## [10,]    NA    NA 0.014
## [11,]    NA    NA    NA
## [12,]    NA    NA    NA
## [13,]    NA    NA    NA
## [14,]    NA    NA    NA
## [15,]    NA    NA    NA
p1<-ggplot(d4, aes(BMI, V6)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="1 and 6")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p2<-ggplot(d4, aes(BMI, V34)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="3 and 4")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p3<-ggplot(d4, aes(BMI, V53)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="4 and 8")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p4<-ggplot(d4, aes(BMI, V60)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="4 and 15")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

ggarrange(p1,p2,p3,p4 + rremove("x.text"), 
          labels = c("A", "B", "C","D"),
          ncol = 2, nrow = 2)

Significant positive AoM

12->15 == V180

matrix( as.matrix(img_p[3,1:225]),nrow=15, ncol=15)
##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
##  [1,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [2,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [3,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [4,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [5,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [6,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [7,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [8,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [9,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [10,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [11,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [12,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [13,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [14,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [15,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA 0.048    NA
##       [,14] [,15]
##  [1,]    NA    NA
##  [2,]    NA    NA
##  [3,]    NA    NA
##  [4,]    NA    NA
##  [5,]    NA    NA
##  [6,]    NA    NA
##  [7,]    NA    NA
##  [8,]    NA    NA
##  [9,]    NA    NA
## [10,]    NA    NA
## [11,]    NA    NA
## [12,]    NA 0.048
## [13,]    NA    NA
## [14,]    NA    NA
## [15,]    NA    NA
p1<-ggplot(d4, aes(Menstrual_AgeBegan, V180)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="12 and 15")+
  scale_x_continuous(name="AoM")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

p1

Significant negative AoM

none

matrix( as.matrix(img_p[4,1:225]),nrow=15, ncol=15)
##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
##  [1,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [2,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [3,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [4,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [5,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [6,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [7,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [8,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [9,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [10,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [11,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [12,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [13,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [14,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [15,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##       [,14] [,15]
##  [1,]    NA    NA
##  [2,]    NA    NA
##  [3,]    NA    NA
##  [4,]    NA    NA
##  [5,]    NA    NA
##  [6,]    NA    NA
##  [7,]    NA    NA
##  [8,]    NA    NA
##  [9,]    NA    NA
## [10,]    NA    NA
## [11,]    NA    NA
## [12,]    NA    NA
## [13,]    NA    NA
## [14,]    NA    NA
## [15,]    NA    NA

Tertiles

So we can visualize the interaction effect

describe(d4$Menstrual_AgeBegan)
## d4$Menstrual_AgeBegan 
##        n  missing distinct     Info     Mean      Gmd      .05      .10 
##      510        0       11    0.947    12.72    1.693    10.00    11.00 
##      .25      .50      .75      .90      .95 
##    12.00    13.00    13.00    15.00    15.55 
##                                                                       
## Value          8     9    10    11    12    13    14    15    16    17
## Frequency      2    12    19    54   147   151    64    35    17     5
## Proportion 0.004 0.024 0.037 0.106 0.288 0.296 0.125 0.069 0.033 0.010
##                 
## Value         18
## Frequency      4
## Proportion 0.008
hist(d4$Menstrual_AgeBegan)

quantile(d4$Menstrual_AgeBegan, prob = c(0.33, 0.66))
## 33% 66% 
##  12  13
d4$AoM[d4$Menstrual_AgeBegan<12]<-"early"
d4$AoM[d4$Menstrual_AgeBegan>13]<-"late"

summary(as.factor(d4$AoM))
## early  late  NA's 
##    87   125   298

Significant positive AoMxBMI

12 (visual cortex)->13 (somatosensory - mouth) == V178

IC 12

IC12 IC12_sub

IC 13

IC13 IC13_sub

3 (visual) -> 6 (cingulo-opercular) == V36

IC 3

IC3 IC3_sub

IC 6

IC6 IC6_sub

matrix( as.matrix(img_p[5,1:225]),nrow=15, ncol=15)
##       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
##  [1,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [2,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [3,]   NA   NA   NA   NA   NA    0   NA   NA   NA    NA    NA    NA    NA
##  [4,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [5,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [6,]   NA   NA    0   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [7,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [8,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##  [9,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [10,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [11,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [12,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA 0.026
## [13,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA 0.026    NA
## [14,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
## [15,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA    NA
##       [,14] [,15]
##  [1,]    NA    NA
##  [2,]    NA    NA
##  [3,]    NA    NA
##  [4,]    NA    NA
##  [5,]    NA    NA
##  [6,]    NA    NA
##  [7,]    NA    NA
##  [8,]    NA    NA
##  [9,]    NA    NA
## [10,]    NA    NA
## [11,]    NA    NA
## [12,]    NA    NA
## [13,]    NA    NA
## [14,]    NA    NA
## [15,]    NA    NA
n=50
p1<-ggplot(subset(d4, !is.na(d4$AoM)), aes(BMI, V36, group=AoM, color=AoM)) +
  geom_point(aes(shape=AoM), size=2) + 
  geom_smooth(method=lm, aes(linetype=AoM))+
  scale_y_continuous(name="Correlation between\n IC3 and IC6")+
  scale_x_continuous(name="BMI")+
  theme_classic()+ 
  scale_shape_manual(values = c(1, 2),
    breaks = c("early","late"),
    labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
    guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  scale_color_manual(values = c("black", "#333333"),
    breaks = c("early","late"),
    labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
    guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  scale_linetype_manual(values=c("solid","dashed"),
                        breaks = c("early","late"),
                        labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
                        guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))

p2<-ggplot(subset(d4, !is.na(d4$AoM)), aes(BMI, V178, group=AoM, color=AoM)) +
  geom_point(aes(shape=AoM), size=2) + 
  geom_smooth(method=lm, aes(linetype=AoM))+
  scale_y_continuous(name="Correlation between\n IC12 and IC13")+
  scale_x_continuous(name="BMI")+
  theme_classic()+ 
  scale_shape_manual(values = c(1, 2),
    breaks = c("early","late"),
    labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
    guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  scale_color_manual(values = c("black", "#333333"),
    breaks = c("early","late"),
    labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
    guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  scale_linetype_manual(values=c("solid","dashed"),
                        breaks = c("early","late"),
                        labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
                        guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))
  

interaction_plot<- ggarrange(p1,p2 ,
                             labels = c("A", "B"),
                             ncol = 2, nrow = 1)
interaction_plot

Significant negative AoMxBMI

2 (DMN) ->3 (visual) == V18 ### IC 2 IC2 IC2_sub

IC 3

IC3 IC3_sub

matrix( as.matrix(img_p[6,1:225]),nrow=15, ncol=15)
##       [,1]  [,2]  [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
##  [1,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [2,]   NA    NA 0.004   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [3,]   NA 0.004    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [4,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [5,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [6,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [7,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [8,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##  [9,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
## [10,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
## [11,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
## [12,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
## [13,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
## [14,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
## [15,]   NA    NA    NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
##       [,13] [,14] [,15]
##  [1,]    NA    NA    NA
##  [2,]    NA    NA    NA
##  [3,]    NA    NA    NA
##  [4,]    NA    NA    NA
##  [5,]    NA    NA    NA
##  [6,]    NA    NA    NA
##  [7,]    NA    NA    NA
##  [8,]    NA    NA    NA
##  [9,]    NA    NA    NA
## [10,]    NA    NA    NA
## [11,]    NA    NA    NA
## [12,]    NA    NA    NA
## [13,]    NA    NA    NA
## [14,]    NA    NA    NA
## [15,]    NA    NA    NA
p3<-ggplot(subset(d4, !is.na(d4$AoM)), aes(BMI, V18, group=AoM, color=AoM)) +
  geom_point(aes(shape=AoM), size=2) + 
  geom_smooth(method=lm, aes(linetype=AoM))+
  scale_y_continuous(name="Correlation between\n IC2 and IC3")+
  scale_x_continuous(name="BMI")+
  theme_classic()+ 
  scale_shape_manual(values = c(1, 2),
    breaks = c("early","late"),
    labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
    guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  scale_color_manual(values = c("black", "#333333"),
    breaks = c("early","late"),
    labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
    guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  scale_linetype_manual(values=c("solid","dashed"),
                        breaks = c("early","late"),
                        labels = c("Early onsent (<12y)", "Late onsent (>13y)"),
                        guide = guide_legend(title.position = "top", title = "Age at onset of menses", size=20))+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))

p3

Post hoc analysis of HCP data for puberty paper

Checking the fertility data

summary(as.factor(d4$Menstrual_UsingBirthControl))
##   0   1 
## 367 143
# yes = 1
onBC<-subset(d4, d4$Menstrual_UsingBirthControl == "1")
summary(as.factor(onBC$Menstrual_UsingBirthControl))
##   1 
## 143
summary(as.factor(onBC$Menstrual_BirthControlCode))
##    1    2    3    4    6 NA's 
##   95   29    1    8    9    1
# 1=OC's for contraception, 2=OC's primarily for menstrual regulation, 3=estradiol for menstrual regulation, 4=progesterone for menstrual regulation, 5=fertility therapy, 6=other, 7=unknown  (Asked of female participants only) 

Checking SES

# SSAGA_Employ SSAGA_Income SSAGA_Educ SSAGA_InSchool SSAGA_Rlshp
## not working = 0, part-time employment = 1; full-time employment = 2
summary(as.factor(d4$SSAGA_Employ))
##   0   1   2 
##  92 105 313
## Total household income: <$10,000 = 1,10K-19,999 = 2, 20K-29,999 = 3,30K-39,999 = 4, 40K-49,999 = 5, 50K-74,999 = 6, 75K-99,999 = 7, >=100,000 = 8
## Low income == 1-2
summary(as.factor(d4$SSAGA_Income))
##    1    2    3    4    5    6    7    8 NA's 
##   39   29   55   67   56  105   77   79    3
## Years of education completed: <11 = 11; 12; 13; 14; 15; 16; 17+ = 17
summary(as.factor(d4$SSAGA_Educ))
##  11  12  13  14  15  16  17 
##  16  69  26  63  19 226  91
## Is respondent still in school for degree course? no = 0; yes = 1
summary(as.factor(d4$SSAGA_InSchool))
##   0   1 
## 419  91
## Is respondent married or in live-in relationship? no = 0; yes = 1
summary(as.factor(d4$SSAGA_Rlshp))
##   0   1 
## 252 258
low_income_single<-subset(d4 , d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('1', '2'))
low_income_married<-subset(d4 , d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('1', '2','3'))
low<-rbind(low_income_married, low_income_single)

d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('1', '2')]<-"low_single"
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('1', '2','3')]<-"low_married"
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('3','4','5','6','7','8')]<-"norm_single"
d4$SES[d4$SSAGA_InSchool == 0 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('4','5','6','7','8')]<-"norm_married"

d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('1', '2')]<-"low_single_school"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('1', '2','3')]<-"low_married_school"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 0 & d4$SSAGA_Income %in% c('3','4','5','6','7','8')]<-"norm_single_school"
d4$SES[d4$SSAGA_InSchool == 1 & d4$SSAGA_Rlshp == 1 & d4$SSAGA_Income %in% c('4','5','6','7','8')]<-"norm_married_school"

d4$SES_comp[d4$SES %in% c('low_single', 'low_married','low_single_school','low_married_school')]<-"low"
d4$SES_comp[d4$SES %in% c('norm_single', 'norm_married','norm_single_school','norm_married_school')]<-"norm"

Defintition of low income

If single: THI < 20K If married: THI <30K

ggplot(subset(d4, d4$SES_comp != is.na(d4$SES_comp)), aes(Menstrual_AgeBegan, BMI, group=SES_comp, color=SES_comp)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+theme_classic()+scale_y_continuous(name="Body Mass Index (BMI)")+
  scale_x_continuous(name="Age of onset of menstration")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))

d4$SES_comp <- factor(d4$SES_comp)
summary(d4$SES_comp)
##  low norm NA's 
##   76  431    3
mylogit <- glm(SES_comp ~ Menstrual_AgeBegan*BMI, data = subset(d4, d4$SES_comp != is.na(d4$SES_comp)), family = "binomial")
summary(mylogit)
## 
## Call:
## glm(formula = SES_comp ~ Menstrual_AgeBegan * BMI, family = "binomial", 
##     data = subset(d4, d4$SES_comp != is.na(d4$SES_comp)))
## 
## Deviance Residuals: 
##     Min       1Q   Median       3Q      Max  
## -2.2908   0.4422   0.5326   0.5909   1.0297  
## 
## Coefficients:
##                         Estimate Std. Error z value Pr(>|z|)
## (Intercept)             2.122846   4.890894   0.434    0.664
## Menstrual_AgeBegan      0.006335   0.390246   0.016    0.987
## BMI                    -0.119432   0.176673  -0.676    0.499
## Menstrual_AgeBegan:BMI  0.008158   0.014238   0.573    0.567
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 428.45  on 506  degrees of freedom
## Residual deviance: 418.88  on 503  degrees of freedom
## AIC: 426.88
## 
## Number of Fisher Scoring iterations: 4

Nodes of interest

sig 3->6 == V36 check 6 -> 3 == V78 12->13 == V192 check 13->12 == V178

Control variables

Race Ethnicity Age_in_Yrs

ctrl1<-lm(BMI~Race+Ethnicity+Age_in_Yrs, data=d4)
p.adjust(coef(summary(ctrl1))[, 4], method="BH")
##                              (Intercept) 
##                             2.417328e-23 
##              RaceAm. Indian/Alaskan Nat. 
##                             6.374647e-01 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                             2.501776e-03 
##                 RaceBlack or African Am. 
##                             2.652613e-07 
##                        RaceMore than one 
##                             8.677432e-01 
##              RaceUnknown or Not Reported 
##                             2.559852e-01 
##             EthnicityNot Hispanic/Latino 
##                             1.695358e-01 
##         EthnicityUnknown or Not Reported 
##                             1.695358e-01 
##                               Age_in_Yrs 
##                             1.412720e-01
ctrl2<-lm(Menstrual_AgeBegan~Race+Ethnicity+Age_in_Yrs, data=d4)
p.adjust(coef(summary(ctrl2))[, 4], method="BH")
##                              (Intercept) 
##                             6.742451e-60 
##              RaceAm. Indian/Alaskan Nat. 
##                             1.118843e-01 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                             1.890923e-01 
##                 RaceBlack or African Am. 
##                             4.124785e-02 
##                        RaceMore than one 
##                             8.690411e-01 
##              RaceUnknown or Not Reported 
##                             9.947862e-01 
##             EthnicityNot Hispanic/Latino 
##                             1.118843e-01 
##         EthnicityUnknown or Not Reported 
##                             9.998632e-01 
##                               Age_in_Yrs 
##                             8.690411e-01
twoM <- rbind(tidy(ctrl1) %>% mutate(model = "Relationshio to BMI"), 
                tidy(ctrl2) %>% mutate(model = "Relationship to age at onset of menses")
                )

SI1<-dwplot(twoM, vline = geom_vline(xintercept = 0, colour = "grey60", linetype = 2)) +theme_classic()
SI1

Looks like I can drop ethnicity since it is not related to either BMI nor Puberty.

False Discovery Correction

Bonferroni Cor #: 11

ad = 11

Delay Discounting: Area Under the Curve for Discounting of $200 (DDisc_AUC_200) Cognition Self-regulation/Impulsivity (Delay Discounting) DDisc_AUC_200

mDD1<-lm(DDisc_AUC_200~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mDD1)
## 
## Call:
## lm(formula = DDisc_AUC_200 ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.33258 -0.12193 -0.04144  0.08120  0.73830 
## 
## Coefficients:
##                                            Estimate Std. Error t value
## (Intercept)                               0.8274071  0.3302516   2.505
## BMI                                      -0.0197156  0.0119813  -1.646
## Menstrual_AgeBegan                       -0.0469446  0.0248398  -1.890
## RaceAm. Indian/Alaskan Nat.              -0.2004296  0.1833454  -1.093
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.0638199  0.0352343   1.811
## RaceBlack or African Am.                 -0.1127362  0.0233714  -4.824
## RaceMore than one                         0.1369166  0.0539355   2.539
## RaceUnknown or Not Reported              -0.0680833  0.0585539  -1.163
## Age_in_Yrs                                0.0015771  0.0023263   0.678
## BMI:Menstrual_AgeBegan                    0.0015134  0.0009354   1.618
##                                          Pr(>|t|)    
## (Intercept)                                0.0126 *  
## BMI                                        0.1005    
## Menstrual_AgeBegan                         0.0594 .  
## RaceAm. Indian/Alaskan Nat.                0.2748    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   0.0707 .  
## RaceBlack or African Am.                 1.88e-06 ***
## RaceMore than one                          0.0114 *  
## RaceUnknown or Not Reported                0.2455    
## Age_in_Yrs                                 0.4981    
## BMI:Menstrual_AgeBegan                     0.1063    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1816 on 497 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.08571,    Adjusted R-squared:  0.06915 
## F-statistic: 5.177 on 9 and 497 DF,  p-value: 9.86e-07

Delay Discounting: Area Under the Curve for Discounting of $40,000 (DDisc_AUC_40K) Cognition Self-regulation/Impulsivity (Delay Discounting) DDisc_AUC_40K

mDD2<-lm(DDisc_AUC_40K~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mDD2)#trend
## 
## Call:
## lm(formula = DDisc_AUC_40K ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.57488 -0.22144 -0.00278  0.23481  0.60842 
## 
## Coefficients:
##                                            Estimate Std. Error t value
## (Intercept)                               1.8160111  0.5001540   3.631
## BMI                                      -0.0470355  0.0181453  -2.592
## Menstrual_AgeBegan                       -0.0941783  0.0376190  -2.503
## RaceAm. Indian/Alaskan Nat.              -0.4497669  0.2776700  -1.620
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.0676138  0.0533610   1.267
## RaceBlack or African Am.                 -0.1692236  0.0353951  -4.781
## RaceMore than one                         0.1326965  0.0816834   1.625
## RaceUnknown or Not Reported              -0.2453774  0.0886778  -2.767
## Age_in_Yrs                                0.0002894  0.0035230   0.082
## BMI:Menstrual_AgeBegan                    0.0034075  0.0014167   2.405
##                                          Pr(>|t|)    
## (Intercept)                              0.000312 ***
## BMI                                      0.009818 ** 
## Menstrual_AgeBegan                       0.012618 *  
## RaceAm. Indian/Alaskan Nat.              0.105912    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.205713    
## RaceBlack or African Am.                  2.3e-06 ***
## RaceMore than one                        0.104899    
## RaceUnknown or Not Reported              0.005867 ** 
## Age_in_Yrs                               0.934558    
## BMI:Menstrual_AgeBegan                   0.016526 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.275 on 497 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.1021, Adjusted R-squared:  0.08587 
## F-statistic: 6.281 on 9 and 497 DF,  p-value: 1.959e-08
p.adjust(coef(summary(mDD2))[, 4], method="BH", ad)
##                              (Intercept) 
##                             1.714493e-03 
##                                      BMI 
##                             2.699981e-02 
##                       Menstrual_AgeBegan 
##                             2.775892e-02 
##              RaceAm. Indian/Alaskan Nat. 
##                             1.456288e-01 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                             2.514268e-01 
##                 RaceBlack or African Am. 
##                             2.531508e-05 
##                        RaceMore than one 
##                             1.456288e-01 
##              RaceUnknown or Not Reported 
##                             2.151296e-02 
##                               Age_in_Yrs 
##                             1.000000e+00 
##                   BMI:Menstrual_AgeBegan 
##                             3.029715e-02

NIH Toolbox Picture Sequence Memory Test: Age-Adjusted Scale Score

mSM1<-lm(PicSeq_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mSM1)
## 
## Call:
## lm(formula = PicSeq_AgeAdj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -46.25 -10.11   0.15  10.67  36.71 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                              112.96597   27.32408   4.134
## BMI                                       -0.63352    0.99091  -0.639
## Menstrual_AgeBegan                        -0.49635    2.05488  -0.242
## RaceAm. Indian/Alaskan Nat.                0.99211   15.17770   0.065
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   7.96689    2.83555   2.810
## RaceBlack or African Am.                  -9.16232    1.93450  -4.736
## RaceMore than one                          3.83875    4.46468   0.860
## RaceUnknown or Not Reported                7.93112    4.84734   1.636
## Age_in_Yrs                                 0.30484    0.19201   1.588
## BMI:Menstrual_AgeBegan                     0.02810    0.07736   0.363
##                                          Pr(>|t|)    
## (Intercept)                              4.18e-05 ***
## BMI                                       0.52290    
## Menstrual_AgeBegan                        0.80923    
## RaceAm. Indian/Alaskan Nat.               0.94791    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.00515 ** 
## RaceBlack or African Am.                 2.84e-06 ***
## RaceMore than one                         0.39031    
## RaceUnknown or Not Reported               0.10243    
## Age_in_Yrs                                0.11300    
## BMI:Menstrual_AgeBegan                    0.71657    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15.03 on 500 degrees of freedom
## Multiple R-squared:  0.0998, Adjusted R-squared:  0.0836 
## F-statistic: 6.159 on 9 and 500 DF,  p-value: 3.01e-08

NIH Toolbox Dimensional Change Card Sort Test: Age-Adjusted Scale Score

mCS1<-lm(CardSort_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCS1)
## 
## Call:
## lm(formula = CardSort_AgeAdj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -43.137  -6.555   0.020   7.097  21.667 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                              105.01522   17.87378   5.875
## BMI                                       -0.08726    0.64772  -0.135
## Menstrual_AgeBegan                         0.34168    1.34359   0.254
## RaceAm. Indian/Alaskan Nat.                2.92154    9.91813   0.295
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  -1.36425    1.85285  -0.736
## RaceBlack or African Am.                  -1.34244    1.26429  -1.062
## RaceMore than one                          0.23302    2.91737   0.080
## RaceUnknown or Not Reported               -1.67815    3.16742  -0.530
## Age_in_Yrs                                 0.03995    0.12598   0.317
## BMI:Menstrual_AgeBegan                    -0.01816    0.05057  -0.359
##                                          Pr(>|t|)    
## (Intercept)                              7.73e-09 ***
## BMI                                         0.893    
## Menstrual_AgeBegan                          0.799    
## RaceAm. Indian/Alaskan Nat.                 0.768    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.    0.462    
## RaceBlack or African Am.                    0.289    
## RaceMore than one                           0.936    
## RaceUnknown or Not Reported                 0.596    
## Age_in_Yrs                                  0.751    
## BMI:Menstrual_AgeBegan                      0.720    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.821 on 498 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.03724,    Adjusted R-squared:  0.01984 
## F-statistic:  2.14 on 9 and 498 DF,  p-value: 0.02493

NIH Toolbox Flanker Inhibitory Control and Attention Test: Age-Adjusted Scale Score

mFl1<-lm(Flanker_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mFl1)
## 
## Call:
## lm(formula = Flanker_AgeAdj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -24.7445  -6.2980   0.1627   6.9671  22.3189 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                              101.55915   17.18122   5.911
## BMI                                        0.09309    0.62308   0.149
## Menstrual_AgeBegan                         0.25581    1.29209   0.198
## RaceAm. Indian/Alaskan Nat.               11.03254    9.54364   1.156
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   0.14332    1.78298   0.080
## RaceBlack or African Am.                  -2.64538    1.21640  -2.175
## RaceMore than one                          2.45298    2.80737   0.874
## RaceUnknown or Not Reported               -3.12606    3.04798  -1.026
## Age_in_Yrs                                -0.09421    0.12073  -0.780
## BMI:Menstrual_AgeBegan                    -0.00949    0.04864  -0.195
##                                          Pr(>|t|)    
## (Intercept)                               6.3e-09 ***
## BMI                                        0.8813    
## Menstrual_AgeBegan                         0.8431    
## RaceAm. Indian/Alaskan Nat.                0.2482    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   0.9360    
## RaceBlack or African Am.                   0.0301 *  
## RaceMore than one                          0.3827    
## RaceUnknown or Not Reported                0.3056    
## Age_in_Yrs                                 0.4356    
## BMI:Menstrual_AgeBegan                     0.8454    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 9.451 on 500 degrees of freedom
## Multiple R-squared:  0.0194, Adjusted R-squared:  0.00175 
## F-statistic: 1.099 on 9 and 500 DF,  p-value: 0.3616

NIH Toolbox Cognition Fluid Composite: Age Adjusted Scale Score

mCF1<-lm(CogFluidComp_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCF1)
## 
## Call:
## lm(formula = CogFluidComp_AgeAdj ~ BMI * Menstrual_AgeBegan + 
##     Race + Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -38.494 -11.829   0.058  11.230  45.417 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                              120.17028   30.45998   3.945
## BMI                                       -0.69154    1.11400  -0.621
## Menstrual_AgeBegan                        -0.60699    2.28751  -0.265
## RaceAm. Indian/Alaskan Nat.               -5.40172   16.24106  -0.333
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   4.33877    3.03543   1.429
## RaceBlack or African Am.                  -9.42034    2.07478  -4.540
## RaceMore than one                          4.71302    4.77730   0.987
## RaceUnknown or Not Reported               -0.54191    5.18652  -0.104
## Age_in_Yrs                                 0.15784    0.20695   0.763
## BMI:Menstrual_AgeBegan                     0.02389    0.08672   0.275
##                                          Pr(>|t|)    
## (Intercept)                              9.13e-05 ***
## BMI                                         0.535    
## Menstrual_AgeBegan                          0.791    
## RaceAm. Indian/Alaskan Nat.                 0.740    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.    0.154    
## RaceBlack or African Am.                 7.06e-06 ***
## RaceMore than one                           0.324    
## RaceUnknown or Not Reported                 0.917    
## Age_in_Yrs                                  0.446    
## BMI:Menstrual_AgeBegan                      0.783    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 16.08 on 493 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.08416,    Adjusted R-squared:  0.06744 
## F-statistic: 5.034 on 9 and 493 DF,  p-value: 1.641e-06

NIH Toolbox Cognition Total Composite Score: Age Adjusted Scale Score

mCCom1<-lm(CogTotalComp_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCCom1)
## 
## Call:
## lm(formula = CogTotalComp_AgeAdj ~ BMI * Menstrual_AgeBegan + 
##     Race + Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -48.751 -11.976  -0.547  12.376  56.076 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                              185.02935   34.95169   5.294
## BMI                                       -2.03710    1.27827  -1.594
## Menstrual_AgeBegan                        -3.95099    2.62483  -1.505
## RaceAm. Indian/Alaskan Nat.              -20.72131   18.63601  -1.112
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  10.33954    3.48304   2.969
## RaceBlack or African Am.                 -16.91864    2.38073  -7.107
## RaceMore than one                          4.07736    5.48178   0.744
## RaceUnknown or Not Reported              -10.71278    5.95134  -1.800
## Age_in_Yrs                                -0.22316    0.23747  -0.940
## BMI:Menstrual_AgeBegan                     0.11761    0.09951   1.182
##                                          Pr(>|t|)    
## (Intercept)                              1.81e-07 ***
## BMI                                       0.11166    
## Menstrual_AgeBegan                        0.13290    
## RaceAm. Indian/Alaskan Nat.               0.26672    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.00314 ** 
## RaceBlack or African Am.                 4.19e-12 ***
## RaceMore than one                         0.45735    
## RaceUnknown or Not Reported               0.07246 .  
## Age_in_Yrs                                0.34781    
## BMI:Menstrual_AgeBegan                    0.23781    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 18.45 on 493 degrees of freedom
##   (7 observations deleted due to missingness)
## Multiple R-squared:  0.1841, Adjusted R-squared:  0.1692 
## F-statistic: 12.36 on 9 and 493 DF,  p-value: < 2.2e-16

NIH Toolbox Cognition Crystallized Composite: Age Adjusted Scale Score

About

The Crystallized Cognition Composite score is derived by averaging the normalized scores of each of the Toolbox tests that are crystallized measures (Picture Vocabulary and Reading Tests), then deriving scale scores based on this new distribution. One can interpret the Crystallized Cognition Composite as a more global assessment of individual and group verbal reasoning. Higher scores indicate higher levels of functioning. Age-adjusted Scale Score: Participant score is normed using the age appropriate band of Toolbox Norming Sample (bands of ages 18-29, or 30-35), where a score of 100 indicates performance that was at the national average and a score of 115 or 85, indicates performance 1 SD above or below the national average for participants age band.

mCCr1<-lm(CogCrystalComp_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mCCr1) #SIGNIFICANT
## 
## Call:
## lm(formula = CogCrystalComp_AgeAdj ~ BMI * Menstrual_AgeBegan + 
##     Race + Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -43.274 -11.104   0.612  10.906  41.016 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                              188.54764   28.62606   6.587
## BMI                                       -2.13047    1.04783  -2.033
## Menstrual_AgeBegan                        -4.88907    2.15105  -2.273
## RaceAm. Indian/Alaskan Nat.              -23.81526   15.28267  -1.558
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  10.05298    2.85552   3.521
## RaceBlack or African Am.                 -14.68716    1.95114  -7.527
## RaceMore than one                          0.58530    4.49483   0.130
## RaceUnknown or Not Reported              -14.68602    4.88015  -3.009
## Age_in_Yrs                                -0.23906    0.19374  -1.234
## BMI:Menstrual_AgeBegan                     0.13882    0.08155   1.702
##                                          Pr(>|t|)    
## (Intercept)                              1.15e-10 ***
## BMI                                       0.04256 *  
## Menstrual_AgeBegan                        0.02346 *  
## RaceAm. Indian/Alaskan Nat.               0.11979    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.00047 ***
## RaceBlack or African Am.                 2.45e-13 ***
## RaceMore than one                         0.89645    
## RaceUnknown or Not Reported               0.00275 ** 
## Age_in_Yrs                                0.21782    
## BMI:Menstrual_AgeBegan                    0.08933 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15.13 on 497 degrees of freedom
##   (3 observations deleted due to missingness)
## Multiple R-squared:  0.2071, Adjusted R-squared:  0.1927 
## F-statistic: 14.42 on 9 and 497 DF,  p-value: < 2.2e-16
### it appears that race only improves the model for Asian therefore we will test this without the asian population which is low (36)
p.adjust(coef(summary(mCCr1))[, 4], method="BH", ad)
##                              (Intercept) 
##                             6.314609e-10 
##                                      BMI 
##                             7.802776e-02 
##                       Menstrual_AgeBegan 
##                             5.161079e-02 
##              RaceAm. Indian/Alaskan Nat. 
##                             1.647171e-01 
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. 
##                             1.724372e-03 
##                 RaceBlack or African Am. 
##                             2.695411e-12 
##                        RaceMore than one 
##                             9.860929e-01 
##              RaceUnknown or Not Reported 
##                             7.565694e-03 
##                               Age_in_Yrs 
##                             2.662187e-01 
##                   BMI:Menstrual_AgeBegan 
##                             1.403815e-01
ggplot(subset(d4, !is.na(AoM)), aes(BMI, CogCrystalComp_AgeAdj, color=AoM, group=AoM)) +
  geom_point(shape=1) + 
  geom_smooth(method=lm)+scale_y_continuous(name="crystal cognition")+
  scale_x_continuous(name="BMI")+
  theme(axis.title.x = element_text( size=20),axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text( size=20),axis.text.y  = element_text(size=20))
## Warning: Removed 2 rows containing non-finite values (stat_smooth).
## Warning: Removed 2 rows containing missing values (geom_point).

# HbA1c

mHb1<-lm(HbA1C~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mHb1)
## 
## Call:
## lm(formula = HbA1C ~ BMI * Menstrual_AgeBegan + Race + Age_in_Yrs, 
##     data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.8576 -0.1744  0.0388  0.1848  0.9460 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                               4.650516   0.887597   5.239
## BMI                                       0.021687   0.032463   0.668
## Menstrual_AgeBegan                        0.020814   0.066581   0.313
## RaceAm. Indian/Alaskan Nat.               0.724743   0.366525   1.977
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.033654   0.084805   0.397
## RaceBlack or African Am.                  0.166618   0.061866   2.693
## RaceMore than one                         0.204308   0.131077   1.559
## RaceUnknown or Not Reported               0.068296   0.131327   0.520
## Age_in_Yrs                                0.009134   0.005763   1.585
## BMI:Menstrual_AgeBegan                   -0.001629   0.002522  -0.646
##                                          Pr(>|t|)    
## (Intercept)                              2.94e-07 ***
## BMI                                       0.50459    
## Menstrual_AgeBegan                        0.75479    
## RaceAm. Indian/Alaskan Nat.               0.04887 *  
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.69176    
## RaceBlack or African Am.                  0.00745 ** 
## RaceMore than one                         0.12007    
## RaceUnknown or Not Reported               0.60339    
## Age_in_Yrs                                0.11399    
## BMI:Menstrual_AgeBegan                    0.51877    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.3602 on 317 degrees of freedom
##   (183 observations deleted due to missingness)
## Multiple R-squared:  0.06124,    Adjusted R-squared:  0.03459 
## F-statistic: 2.298 on 9 and 317 DF,  p-value: 0.01642

NIH Toolbox 2-minute Walk Endurance Test : Age-Adjusted Scale Score Motor Endurance (2 minute walk test) Endurance_AgeAdj

mEn1<-lm(Endurance_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mEn1)
## 
## Call:
## lm(formula = Endurance_AgeAdj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -36.356  -7.474   0.017   7.837  29.801 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                               91.83503   19.78930   4.641
## BMI                                       -0.39292    0.71763  -0.548
## Menstrual_AgeBegan                         1.15945    1.48816   0.779
## RaceAm. Indian/Alaskan Nat.              -10.45314   10.99178  -0.951
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   1.11517    2.05390   0.543
## RaceBlack or African Am.                  -5.70515    1.40156  -4.071
## RaceMore than one                         -2.14498    3.23369  -0.663
## RaceUnknown or Not Reported               -4.81137    3.51079  -1.370
## Age_in_Yrs                                 0.66976    0.13915   4.813
## BMI:Menstrual_AgeBegan                    -0.03278    0.05602  -0.585
##                                          Pr(>|t|)    
## (Intercept)                              4.44e-06 ***
## BMI                                         0.584    
## Menstrual_AgeBegan                          0.436    
## RaceAm. Indian/Alaskan Nat.                 0.342    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.    0.587    
## RaceBlack or African Am.                 5.45e-05 ***
## RaceMore than one                           0.507    
## RaceUnknown or Not Reported                 0.171    
## Age_in_Yrs                               1.97e-06 ***
## BMI:Menstrual_AgeBegan                      0.559    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 10.89 on 499 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.2352, Adjusted R-squared:  0.2214 
## F-statistic: 17.05 on 9 and 499 DF,  p-value: < 2.2e-16

NIH Toolbox Grip Strength Test: Age-Adjusted-Adjusted Scale Score Motor Strength (Grip Strength Dynamometry) Strength_AgeAdj

mSt1<-lm(Strength_AgeAdj ~ BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mSt1)
## 
## Call:
## lm(formula = Strength_AgeAdj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -42.312  -7.655  -0.642   6.098  32.964 
## 
## Coefficients:
##                                          Estimate Std. Error t value
## (Intercept)                              35.76141   20.84647   1.715
## BMI                                       1.40293    0.75600   1.856
## Menstrual_AgeBegan                        2.56273    1.56774   1.635
## RaceAm. Indian/Alaskan Nat.              13.24996   11.57958   1.144
## RaceAsian/Nat. Hawaiian/Othr Pacific Is. -2.61721    2.16334  -1.210
## RaceBlack or African Am.                  4.04648    1.47590   2.742
## RaceMore than one                         0.17506    3.40626   0.051
## RaceUnknown or Not Reported              -0.74205    3.69820  -0.201
## Age_in_Yrs                                0.46774    0.14649   3.193
## BMI:Menstrual_AgeBegan                   -0.08986    0.05902  -1.522
##                                          Pr(>|t|)   
## (Intercept)                               0.08688 . 
## BMI                                       0.06408 . 
## Menstrual_AgeBegan                        0.10275   
## RaceAm. Indian/Alaskan Nat.               0.25307   
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.22693   
## RaceBlack or African Am.                  0.00633 **
## RaceMore than one                         0.95903   
## RaceUnknown or Not Reported               0.84105   
## Age_in_Yrs                                0.00150 **
## BMI:Menstrual_AgeBegan                    0.12852   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 11.47 on 500 degrees of freedom
## Multiple R-squared:  0.08035,    Adjusted R-squared:  0.0638 
## F-statistic: 4.854 on 9 and 500 DF,  p-value: 3.057e-06

NIH Toolbox Perceived Stress Survey: Unadjusted Scale Score Emotion Stress and Self Efficacy (Perceived Stress, Self-Efficacy) PercStress_Unadj

mStress1<-lm(PercStress_Unadj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mStress1)
## 
## Call:
## lm(formula = PercStress_Unadj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -27.9184  -5.4434  -0.2983   4.9690  30.1910 
## 
## Coefficients:
##                                          Estimate Std. Error t value
## (Intercept)                              60.35576   16.05213   3.760
## BMI                                      -0.07033    0.58202  -0.121
## Menstrual_AgeBegan                       -0.60687    1.20676  -0.503
## RaceAm. Indian/Alaskan Nat.              10.72355    8.91277   1.203
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.24631    1.66542   0.148
## RaceBlack or African Am.                  1.32934    1.14323   1.163
## RaceMore than one                         0.92817    2.62189   0.354
## RaceUnknown or Not Reported               2.05733    2.84648   0.723
## Age_in_Yrs                               -0.23207    0.11292  -2.055
## BMI:Menstrual_AgeBegan                    0.01349    0.04543   0.297
##                                          Pr(>|t|)    
## (Intercept)                               0.00019 ***
## BMI                                       0.90387    
## Menstrual_AgeBegan                        0.61526    
## RaceAm. Indian/Alaskan Nat.               0.22948    
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.88249    
## RaceBlack or African Am.                  0.24547    
## RaceMore than one                         0.72348    
## RaceUnknown or Not Reported               0.47016    
## Age_in_Yrs                                0.04039 *  
## BMI:Menstrual_AgeBegan                    0.76666    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 8.826 on 499 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.02416,    Adjusted R-squared:  0.006555 
## F-statistic: 1.372 on 9 and 499 DF,  p-value: 0.1976

Taste_AgeAdj

mTaste1<-lm(Taste_AgeAdj~BMI*Menstrual_AgeBegan+Race+Age_in_Yrs, data = d4)
summary(mTaste1)
## 
## Call:
## lm(formula = Taste_AgeAdj ~ BMI * Menstrual_AgeBegan + Race + 
##     Age_in_Yrs, data = d4)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -32.946 -10.579   0.442   8.924  34.713 
## 
## Coefficients:
##                                           Estimate Std. Error t value
## (Intercept)                               51.49530   25.72285   2.002
## BMI                                        1.48828    0.93253   1.596
## Menstrual_AgeBegan                         2.75580    1.93366   1.425
## RaceAm. Indian/Alaskan Nat.              -15.08900   14.28005  -1.057
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   3.34109    2.70026   1.237
## RaceBlack or African Am.                   3.36626    1.84077   1.829
## RaceMore than one                          1.69588    4.20101   0.404
## RaceUnknown or Not Reported               13.26855    5.08144   2.611
## Age_in_Yrs                                 0.12685    0.18139   0.699
## BMI:Menstrual_AgeBegan                    -0.10341    0.07279  -1.421
##                                          Pr(>|t|)   
## (Intercept)                                0.0458 * 
## BMI                                        0.1111   
## Menstrual_AgeBegan                         0.1547   
## RaceAm. Indian/Alaskan Nat.                0.2912   
## RaceAsian/Nat. Hawaiian/Othr Pacific Is.   0.2166   
## RaceBlack or African Am.                   0.0680 . 
## RaceMore than one                          0.6866   
## RaceUnknown or Not Reported                0.0093 **
## Age_in_Yrs                                 0.4847   
## BMI:Menstrual_AgeBegan                     0.1561   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.14 on 495 degrees of freedom
##   (5 observations deleted due to missingness)
## Multiple R-squared:  0.03516,    Adjusted R-squared:  0.01761 
## F-statistic: 2.004 on 9 and 495 DF,  p-value: 0.03707

Heritability

Self-reported zygosity. Until the S1200 release this was the " measure. The small number of subjects who do not have a value for this measure (blank) self reported as twins but did not self report their twin zygosity."
Twin zygosity verified by genotyping. Requires both subjects in a twin pair to have HasGT=TRUE to have a value (if genotyping is not available for either of a twin pair, no values are given for ZygosityGT). Non-twin subjects also do not have a value for ZygosityGT. Note that some subjects self-reported as dizygotic twins (ZygositySR=‘NotMZ’) but genotyping established that they were monozygotic twins (thence ZygosityGT=‘MZ’ for those subjects). ZygosityGT should be given precedence over ZygositySR.

Nodes of interest

sig 3->6 == V36 check 6 -> 3 == V78 12->13 == V192 check 13->12 == V178

twins<-subset(d4 , d4$ZygosityGT %in% c('DZ', 'MZ'))
myvars<-c("Family_ID","Subject","Menstrual_AgeBegan","BMI","ZygosityGT","Age_in_Yrs","Race","Gender","V36","V78","V178","V192")
d5<-twins[myvars]
d5$ZygosityGT<-factor(d5$ZygosityGT)
d5$Race<-factor(d5$Race)
d6 <- fast.reshape(d5, id="Family_ID",varying=c("BMI","Menstrual_AgeBegan","Subject","V36","V78","V178","V192"))
d6<-na.omit(d6)
head(d6)
##       Family_ID Subject1 Menstrual_AgeBegan1  BMI1 ZygosityGT Age_in_Yrs
## 223 51279_81145   139637                  12 24.95         MZ         35
## 857 51293_81159   552544                  11 28.66         DZ         35
## 488 51295_81161   191437                  11 44.70         DZ         35
## 150 51300_81166   127832                  15 20.72         DZ         35
## 319 51303_81168   157336                  13 22.27         DZ         34
## 141 51304_81169   125525                  14 21.46         MZ         34
##      Race Gender     V361     V781   V1781   V1921  BMI2
## 223 White      F -2.00540 -2.00540 16.3360 16.3360 28.20
## 857 White      F  0.63242  0.63242  5.3064  5.3064 19.37
## 488 White      F -2.49730 -2.49730 -4.3874 -4.3874 34.50
## 150 White      F -5.63610 -5.63610  8.9695  8.9695 23.69
## 319 White      F -2.40650 -2.40650  4.7688  4.7688 20.99
## 141 White      F  5.30000  5.30000  5.9922  5.9922 20.01
##     Menstrual_AgeBegan2 Subject2     V362     V782    V1782    V1922
## 223                  15   677968 -3.64770 -3.64770 10.15000 10.15000
## 857                  12   887373  0.73871  0.73871 11.19500 11.19500
## 488                  13   559053 -0.60196 -0.60196 -2.67200 -2.67200
## 150                  12   137431 -4.62170 -4.62170  0.68453  0.68453
## 319                  13   429040 -0.50878 -0.50878  6.30830  6.30830
## 141                  14   192439 -0.81324 -0.81324  2.76340  2.76340
library("cowplot")  
## 
## ********************************************************
## Note: As of version 1.0.0, cowplot does not change the
##   default ggplot2 theme anymore. To recover the previous
##   behavior, execute:
##   theme_set(theme_cowplot())
## ********************************************************
## 
## Attaching package: 'cowplot'
## The following object is masked from 'package:mosaic':
## 
##     theme_map
## The following object is masked from 'package:ggpubr':
## 
##     get_legend
scatterdens <- function(x) {
  sp <- ggplot(x,aes_string(colnames(x)[1], colnames(x)[2])) + theme_minimal() + geom_point(alpha=0.3) + geom_density_2d()
  xdens <- ggplot(x, aes_string(colnames(x)[1],fill=1)) + theme_minimal() +  geom_density(alpha=.5)+ theme(axis.text.x = element_blank(), legend.position =  "none"  ) + labs(x=NULL) 
  ydens <- ggplot(x, aes_string(colnames(x)[2],fill=1)) +  theme_minimal() +  geom_density(alpha=.5) +    theme(axis.text.y = element_blank(),  axis.text.x = element_text(angle=90, vjust=0), legend.position =  "none"  ) +  labs(x=NULL) + coord_flip()   
  g <- plot_grid(xdens,NULL,sp,ydens, ncol=2,nrow=2,                                                                         rel_widths=c(4,1.4),rel_heights=c(1.4,4))   
  return(g)  
}
mz_bmi <- log(subset(d6, ZygosityGT ==  "MZ"  )[,c("BMI1","BMI2")])  
p_bmi_mz<-scatterdens(mz_bmi)
mz_aom<-subset(d6, ZygosityGT ==  "MZ"  )[,c("Menstrual_AgeBegan1","Menstrual_AgeBegan2")]
p_aom_mz<-scatterdens(mz_aom)

mz_V178<-subset(d6, ZygosityGT ==  "MZ"  )[,c("V1781","V1782")]
p_V178_mz<-scatterdens(mz_V178)

mz_V36<-subset(d6, ZygosityGT ==  "MZ"  )[,c("V361","V362")]
p_V36_mz<-scatterdens(mz_V36)



dz_bmi <- log(subset(d6, ZygosityGT ==  "DZ"  )[,c(  "BMI1"  ,  "BMI2"  )]) 
p_bmi_dz<-scatterdens(dz_bmi)
dz_aom<-subset(d6, ZygosityGT ==  "DZ"  )[,c("Menstrual_AgeBegan1","Menstrual_AgeBegan2")]
p_aom_dz<-scatterdens(dz_aom)

dz_V178<-subset(d6, ZygosityGT ==  "DZ"  )[,c("V1781","V1782")]
p_V178_dz<-scatterdens(dz_V178)

dz_V36<-subset(d6, ZygosityGT ==  "DZ"  )[,c("V361","V362")]
p_V36_dz<-scatterdens(dz_V36)

pBMI<-ggarrange(p_bmi_mz,p_bmi_dz + rremove("x.text"), 
          labels = c("A", "B"),
          ncol = 2, nrow = 1)

pAoM<-ggarrange(p_aom_mz,p_aom_dz + rremove("x.text"), 
          labels = c("A", "B"),
          ncol = 2, nrow = 1)

pV178<-ggarrange(p_V178_mz,p_V178_dz + rremove("x.text"), 
          labels = c("A", "B"),
          ncol = 2, nrow = 1)

pV36<-ggarrange(p_V36_mz,p_V36_dz + rremove("x.text"), 
          labels = c("A", "B"),
          ncol = 2, nrow = 1)
cor.test(mz_bmi[,1],mz_bmi[,2], method=  "spearman"  )  
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
## 
##  Spearman's rank correlation rho
## 
## data:  x and y
## S = 17655, p-value = 2.06e-07
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.5958124
cor.test(dz_bmi[,1],dz_bmi[,2], method=  "spearman"  )  
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
## 
##  Spearman's rank correlation rho
## 
## data:  x and y
## S = 3832.8, p-value = 0.2189
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.2272636
cor.test(mz_aom[,1],mz_aom[,2], method=  "spearman"  )  
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
## 
##  Spearman's rank correlation rho
## 
## data:  x and y
## S = 26715, p-value = 0.001517
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##     rho 
## 0.38839
cor.test(dz_aom[,1],dz_aom[,2], method=  "spearman"  )  
## Warning in cor.test.default(x, y, ...): Cannot compute exact p-value with
## ties
## 
##  Spearman's rank correlation rho
## 
## data:  x and y
## S = 2547.6, p-value = 0.005531
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.4863782

About the results

Heritability is formally defined as the proportion of phenotypic variation (VP) that is due to variation in genetic values (VG).
### Broad-sense heritability
Defined as H2 = VG/VP, captures the proportion of phenotypic variation due to genetic values that may include effects due to dominance and epistasis. * dominance - possible allelic interactions within loci
* epistasis- between loci

Narrow-sense heritability

h2 = VA/VP, refers to the proportion of phenotypic variation that is due to additive genetic values (VA)

The phenotypic variance (VP) in a population is influenced by genetic variance (VG) and environmental sources (VE)

VP = VG + VE so then narrow sense is also defined as:

h2 = EA/(VG+VE)

The total amount of genetic variance can be divided into several groups, including additive variance (VA), dominance variance (VD), and epistatic variance (VI). VG = VA + VD + VI so then narrow sense is also:

h2 = VA/(VA+VD+VI+VE)

variance components

  • additive genetic (A)
  • common shared family environment (C)
  • non-shared environmental (E)
  • genetic dominance effects (D)
dd<-na.omit(d5)
dd$ZygosityGT <- factor(dd$ZygosityGT)
dd$Race<- factor(dd$Race)
l0 <- twinlm(BMI ~ 1+Age_in_Yrs+Race+Menstrual_AgeBegan, data=dd,  DZ= "DZ"  , zyg=  "ZygosityGT"  , id="Family_ID", type="aced", missing = T)  
summary(l0)
##                                               Estimate Std. Error Z value
## BMI                                           29.98942    5.43080  5.5221
## sd(A)                                          1.76291  221.43510  0.0080
## sd(C)                                          0.46039  283.02369  0.0016
## sd(D)                                          3.63867   71.48488  0.0509
## sd(E)                                          2.96324    0.28443 10.4182
## BMI~Age_in_Yrs                                 0.16909    0.14142  1.1957
## BMI~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  -4.20867    2.27972 -1.8461
## BMI~RaceBlack or African Am.                   4.83557    1.29975  3.7204
## BMI~RaceMore than one                          0.54532    5.05986  0.1078
## BMI~RaceUnknown or Not Reported               -0.70485    2.57185 -0.2741
## BMI~Menstrual_AgeBegan                        -0.74964    0.22699 -3.3025
##                                               Pr(>|z|)
## BMI                                           3.35e-08
## sd(A)                                        0.9936479
## sd(C)                                        0.9987021
## sd(D)                                        0.9594042
## sd(E)                                        < 2.2e-16
## BMI~Age_in_Yrs                               0.2318241
## BMI~RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.0648726
## BMI~RaceBlack or African Am.                 0.0001989
## BMI~RaceMore than one                        0.9141759
## BMI~RaceUnknown or Not Reported              0.7840359
## BMI~Menstrual_AgeBegan                       0.0009581
## 
## MZ-pairs/singletons DZ-pairs/singletons 
##               64/16               31/21 
## 
## Variance decomposition:
##   Estimate  2.5%      97.5%    
## A   0.12264 -60.26376  60.50905
## C   0.00836 -20.14805  20.16478
## D   0.52248 -39.71361  40.75857
## E   0.34651   0.19970   0.49332
## 
## 
##                          Estimate  2.5%      97.5%    
## Broad-sense heritability   0.64512 -19.51273  20.80298
## 
##                        Estimate 2.5%     97.5%   
## Correlation within MZ:  0.65349  0.48165  0.77694
## Correlation within DZ:  0.20031 -0.12655  0.48792
## 
## 'log Lik.' -670.5197 (df=11)
## AIC: 1363.039 
## BIC: 1394.75
bmi_acde<-summary(l0)$acde
dim(bmi_acde)
## [1] 4 3
bmi_acde %>%
  kable(digits = c(2,2,2)) %>%
  kable_styling( position = "left") %>%
  add_header_above(c(" "= 1, " " = 1, "Confidence Interval" = 2))
Confidence Interval
Estimate 2.5% 97.5%
A 0.12 -60.26 60.51
C 0.01 -20.15 20.16
D 0.52 -39.71 40.76
E 0.35 0.20 0.49
l1 <- twinlm(Menstrual_AgeBegan ~ 1+Age_in_Yrs+Race, data=dd,  DZ= "DZ"  , zyg=  "ZygosityGT"  , id="Family_ID", type="aced", missing = T)  
summary(l1) 
##                                                              Estimate
## Menstrual_AgeBegan                                          14.458477
## sd(A)                                                        0.621930
## sd(C)                                                        0.523371
## sd(D)                                                        0.647096
## sd(E)                                                        1.040113
## Menstrual_AgeBegan~Age_in_Yrs                               -0.052359
## Menstrual_AgeBegan~RaceAsian/Nat. Hawaiian/Othr Pacific Is. -0.106312
## Menstrual_AgeBegan~RaceBlack or African Am.                 -1.223709
## Menstrual_AgeBegan~RaceMore than one                        -0.782993
## Menstrual_AgeBegan~RaceUnknown or Not Reported              -1.047328
##                                                             Std. Error
## Menstrual_AgeBegan                                            1.238585
## sd(A)                                                        10.546708
## sd(C)                                                         4.198202
## sd(D)                                                         6.765880
## sd(E)                                                         0.093835
## Menstrual_AgeBegan~Age_in_Yrs                                 0.040572
## Menstrual_AgeBegan~RaceAsian/Nat. Hawaiian/Othr Pacific Is.   0.657836
## Menstrual_AgeBegan~RaceBlack or African Am.                   0.367372
## Menstrual_AgeBegan~RaceMore than one                          1.476674
## Menstrual_AgeBegan~RaceUnknown or Not Reported                0.775562
##                                                             Z value
## Menstrual_AgeBegan                                          11.6734
## sd(A)                                                        0.0590
## sd(C)                                                        0.1247
## sd(D)                                                        0.0956
## sd(E)                                                       11.0845
## Menstrual_AgeBegan~Age_in_Yrs                               -1.2905
## Menstrual_AgeBegan~RaceAsian/Nat. Hawaiian/Othr Pacific Is. -0.1616
## Menstrual_AgeBegan~RaceBlack or African Am.                 -3.3310
## Menstrual_AgeBegan~RaceMore than one                        -0.5302
## Menstrual_AgeBegan~RaceUnknown or Not Reported              -1.3504
##                                                              Pr(>|z|)
## Menstrual_AgeBegan                                          < 2.2e-16
## sd(A)                                                       0.9529767
## sd(C)                                                       0.9007884
## sd(D)                                                       0.9238056
## sd(E)                                                       < 2.2e-16
## Menstrual_AgeBegan~Age_in_Yrs                               0.1968679
## Menstrual_AgeBegan~RaceAsian/Nat. Hawaiian/Othr Pacific Is. 0.8716143
## Menstrual_AgeBegan~RaceBlack or African Am.                 0.0008654
## Menstrual_AgeBegan~RaceMore than one                        0.5959447
## Menstrual_AgeBegan~RaceUnknown or Not Reported              0.1768842
## 
## MZ-pairs/singletons DZ-pairs/singletons 
##               64/16               31/21 
## 
## Variance decomposition:
##   Estimate  2.5%      97.5%    
## A   0.17897 -11.71756  12.07550
## C   0.12674  -3.85818   4.11165
## D   0.19374  -7.74676   8.13425
## E   0.50055   0.31435   0.68675
## 
## 
##                          Estimate 2.5%     97.5%   
## Broad-sense heritability  0.37271 -3.61992  4.36534
## 
##                        Estimate 2.5%     97.5%   
## Correlation within MZ:  0.49945  0.29176  0.66216
## Correlation within DZ:  0.26466 -0.03162  0.51818
## 
## 'log Lik.' -399.2659 (df=10)
## AIC: 818.5318 
## BIC: 847.3598
aom_acde<-summary(l1)$acde
aom_acde %>%
  kable(digits = c(2,2,2)) %>%
  kable_styling( position = "left") %>%
  add_header_above(c(" "= 1, " " = 1, "Confidence Interval" = 2))
Confidence Interval
Estimate 2.5% 97.5%
A 0.18 -11.72 12.08
C 0.13 -3.86 4.11
D 0.19 -7.75 8.13
E 0.50 0.31 0.69
l2 <- twinlm(V178 ~ 1+BMI*Menstrual_AgeBegan+Age_in_Yrs+Race, data=d5,
DZ= "DZ"  , zyg=  "ZygosityGT"  , id="Family_ID", type="aced", missing = T)  
summary(l2) 
##                                                  Estimate  Std. Error
## V178                                           1.7149e+01  1.2005e+01
## sd(A)                                         -1.4697e-12  5.2019e+00
## sd(C)                                          2.8295e-04  3.0033e+00
## sd(D)                                          3.3045e+00  3.1772e-01
## sd(E)                                          2.7786e+00  2.3867e-01
## V178~BMI                                      -6.6793e-01  4.1285e-01
## V178~Menstrual_AgeBegan                       -9.9781e-01  8.7188e-01
## V178~Age_in_Yrs                                3.6985e-03  1.2005e-01
## V178~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  1.2163e-01  1.9589e+00
## V178~RaceBlack or African Am.                  2.3082e+00  1.1523e+00
## V178~RaceMore than one                         9.8739e+00  4.3393e+00
## V178~RaceUnknown or Not Reported               7.9634e-01  2.2467e+00
## V178~BMI:Menstrual_AgeBegan                    4.8170e-02  3.2900e-02
##                                               Z value Pr(>|z|)
## V178                                           1.4285  0.15315
## sd(A)                                          0.0000  1.00000
## sd(C)                                          0.0001  0.99992
## sd(D)                                         10.4007  < 2e-16
## sd(E)                                         11.6417  < 2e-16
## V178~BMI                                      -1.6178  0.10570
## V178~Menstrual_AgeBegan                       -1.1444  0.25244
## V178~Age_in_Yrs                                0.0308  0.97542
## V178~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.0621  0.95049
## V178~RaceBlack or African Am.                  2.0032  0.04516
## V178~RaceMore than one                         2.2755  0.02288
## V178~RaceUnknown or Not Reported               0.3544  0.72300
## V178~BMI:Menstrual_AgeBegan                    1.4641  0.14316
## 
## MZ-pairs/singletons DZ-pairs/singletons 
##               64/16               31/21 
## 
## Variance decomposition:
##   Estimate 2.5%     97.5%   
## A  0.00000  0.00000  0.00000
## C  0.00000 -0.00018  0.00018
## D  0.58581  0.43771  0.73391
## E  0.41419  0.26609  0.56229
## 
## 
##                          Estimate 2.5%    97.5%  
## Broad-sense heritability 0.58581  0.43771 0.73391
## 
##                        Estimate 2.5%    97.5%  
## Correlation within MZ: 0.58581  0.41843 0.71471
## Correlation within DZ: 0.14645  0.10924 0.18326
## 
## 'log Lik.' -640.335 (df=13)
## AIC: 1306.67 
## BIC: 1344.146
V178_acde<-summary(l2)$acde
V178_acde %>%
  kable(digits = c(2,2,2)) %>%
  kable_styling( position = "left") %>%
  add_header_above(c(" "= 1, " " = 1, "Confidence Interval" = 2))
Confidence Interval
Estimate 2.5% 97.5%
A 0.00 0.00 0.00
C 0.00 0.00 0.00
D 0.59 0.44 0.73
E 0.41 0.27 0.56
l3 <- twinlm(V36 ~ 1+BMI*Menstrual_AgeBegan+Age_in_Yrs+Race, data=d5,
DZ= "DZ"  , zyg=  "ZygosityGT"  , id="Family_ID", type="aced", missing = T)  
y<-summary(l3) 
names(y)
##  [1] "estimate"     "zyg"          "varEst"       "KinshipGroup"
##  [5] "varSigma"     "heritability" "corMZ"        "corDZ"       
##  [9] "acde"         "logLik"       "AIC"          "BIC"         
## [13] "type"         "coef"         "all"          "vcov"
y$estimate
##                                                 Estimate  Std. Error
## V36                                          23.40046089  9.18999022
## sd(A)                                         1.41698271 34.06610392
## sd(C)                                         0.73848423 21.84796310
## sd(D)                                         1.87918611 17.15289527
## sd(E)                                         2.16023438  0.19556098
## V36~BMI                                      -0.81879925  0.31540241
## V36~Menstrual_AgeBegan                       -2.04426203  0.66679289
## V36~Age_in_Yrs                                0.05423264  0.09192394
## V36~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  2.04076799  1.50218670
## V36~RaceBlack or African Am.                 -0.68257554  0.88046424
## V36~RaceMore than one                        -4.74735968  3.29601859
## V36~RaceUnknown or Not Reported               3.59766763  1.71487090
## V36~BMI:Menstrual_AgeBegan                    0.06558587  0.02510620
##                                                  Z value     Pr(>|z|)
## V36                                           2.54629878 1.088720e-02
## sd(A)                                         0.04159509 9.668215e-01
## sd(C)                                         0.03380106 9.730358e-01
## sd(D)                                         0.10955504 9.127623e-01
## sd(E)                                        11.04634659 2.283185e-28
## V36~BMI                                      -2.59604629 9.430336e-03
## V36~Menstrual_AgeBegan                       -3.06581259 2.170793e-03
## V36~Age_in_Yrs                                0.58997297 5.552088e-01
## V36~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  1.35853152 1.742951e-01
## V36~RaceBlack or African Am.                 -0.77524505 4.381949e-01
## V36~RaceMore than one                        -1.44033159 1.497736e-01
## V36~RaceUnknown or Not Reported               2.09792331 3.591192e-02
## V36~BMI:Menstrual_AgeBegan                    2.61233736 8.992547e-03
y
##                                               Estimate Std. Error Z value
## V36                                          23.400461   9.189990  2.5463
## sd(A)                                         1.416983  34.066104  0.0416
## sd(C)                                         0.738484  21.847963  0.0338
## sd(D)                                         1.879186  17.152895  0.1096
## sd(E)                                         2.160234   0.195561 11.0463
## V36~BMI                                      -0.818799   0.315402 -2.5960
## V36~Menstrual_AgeBegan                       -2.044262   0.666793 -3.0658
## V36~Age_in_Yrs                                0.054233   0.091924  0.5900
## V36~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  2.040768   1.502187  1.3585
## V36~RaceBlack or African Am.                 -0.682576   0.880464 -0.7752
## V36~RaceMore than one                        -4.747360   3.296019 -1.4403
## V36~RaceUnknown or Not Reported               3.597668   1.714871  2.0979
## V36~BMI:Menstrual_AgeBegan                    0.065586   0.025106  2.6123
##                                               Pr(>|z|)
## V36                                           0.010887
## sd(A)                                         0.966821
## sd(C)                                         0.973036
## sd(D)                                         0.912762
## sd(E)                                        < 2.2e-16
## V36~BMI                                       0.009430
## V36~Menstrual_AgeBegan                        0.002171
## V36~Age_in_Yrs                                0.555209
## V36~RaceAsian/Nat. Hawaiian/Othr Pacific Is.  0.174295
## V36~RaceBlack or African Am.                  0.438195
## V36~RaceMore than one                         0.149774
## V36~RaceUnknown or Not Reported               0.035912
## V36~BMI:Menstrual_AgeBegan                    0.008993
## 
## MZ-pairs/singletons DZ-pairs/singletons 
##               64/16               31/21 
## 
## Variance decomposition:
##   Estimate  2.5%      97.5%    
## A   0.18676 -17.41300  17.78652
## C   0.05073  -5.83187   5.93332
## D   0.32846 -11.42398  12.08090
## E   0.43406   0.26848   0.59963
## 
## 
##                          Estimate 2.5%     97.5%   
## Broad-sense heritability  0.51522 -5.37077  6.40121
## 
##                        Estimate 2.5%     97.5%   
## Correlation within MZ:  0.56594  0.37818  0.70898
## Correlation within DZ:  0.22622 -0.17610  0.56378
## 
## 'log Lik.' -578.4964 (df=13)
## AIC: 1182.993 
## BIC: 1220.469
V36_acde<-summary(l3)$acde
V36_acde %>%
  kable(digits = c(2,2,2)) %>%
  kable_styling( position = "left") %>%
  add_header_above(c(" "= 1, " " = 1, "Confidence Interval" = 2))
Confidence Interval
Estimate 2.5% 97.5%
A 0.19 -17.41 17.79
C 0.05 -5.83 5.93
D 0.33 -11.42 12.08
E 0.43 0.27 0.60
x0<-summary(l0)
x1<-summary(l1)
x2<-summary(l2)
x3<-summary(l3)
y0<-as.data.frame(x0[9])
y1<-as.data.frame(x1[9])
y2<-as.data.frame(x2[9])
y3<-as.data.frame(x3[9])

y0$fac<-row.names(y0)
y1$fac<-row.names(y1)
y2$fac<-row.names(y2)
y3$fac<-row.names(y3)
pd <- position_dodge(0.1) 
n0= 3

plt0<-ggplot(y0, aes(x=fac, y=acde.Estimate, color=fac)) + 
  ggtitle("BMI") + 
  geom_point(position=position_dodge(), stat="identity",size=n0) +
  geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
                size=1,    
                width=.5,
                position=position_dodge(.9))+
  geom_hline(aes(yintercept = 0),  color = "grey")+
  scale_color_manual(values = c("#000000", "#999999", "#CCCCCC",  "#666666"))+
  theme_classic()+
  scale_x_discrete(name="Genetic component")+
  scale_y_continuous(name="Estimate")+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))+
  theme(legend.position="none")
  

plt1<-ggplot(y1, aes(x=fac, y=acde.Estimate, color=fac)) + 
  ggtitle("Age at onset of menses") + 
  geom_point(position=position_dodge(), stat="identity",size=n0) +
  geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
                size=1,    
                width=.5,
                position=position_dodge(.9))+
  geom_hline(aes(yintercept = 0),  color = "grey")+
  scale_color_manual(values = c("#000000", "#999999", "#CCCCCC",  "#666666"))+
  theme_classic()+
  scale_x_discrete(name="Genetic component")+
  scale_y_continuous(name="Estimate")+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))+
  theme(legend.position="none")
  

plt2<-ggplot(y2, aes(x=fac, y=acde.Estimate, color=fac)) + 
  ggtitle("Correlation between IC12 and IC13") + 
  theme(plot.title = element_text(size = 20, face = "bold"))+
  geom_point(position=position_dodge(), stat="identity",size=n0) +
  geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
                size=1,    
                width=.5,
                position=position_dodge(.9))+
  geom_hline(aes(yintercept = 0),  color = "grey")+
  scale_color_manual(values = c("#000000", "#999999", "#CCCCCC",  "#666666"))+
  theme_classic()+
  scale_x_discrete(name="Genetic component")+
  scale_y_continuous(name="Estimate")+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))+
  theme(legend.position="none")

plt3<-ggplot(y3, aes(x=fac, y=acde.Estimate, color=fac)) + 
  ggtitle("Correlation between IC3 and IC6") + 
  theme(plot.title = element_text(size = 20, face = "bold"))+
  geom_point(position=position_dodge(), stat="identity",size=n0) +
  geom_errorbar(aes(ymin=acde.2.5., ymax=acde.97.5.),
                size=1,    
                width=.5,
                position=position_dodge(.9))+
  geom_hline(aes(yintercept = 0),  color = "grey")+
  scale_color_manual(values = c("#000000", "#999999", "#CCCCCC",  "#666666"))+
  theme_classic()+
  scale_x_discrete(name="Genetic component")+
  scale_y_continuous(name="Estimate")+
  theme(axis.title.x = element_text(size=20), axis.text.x  = element_text(size=20))+
  theme(axis.title.y = element_text(size=20), axis.text.y  = element_text(size=20))+ 
  theme(legend.text = element_text(size=20))+ 
  theme(legend.title = element_text(size=20, face="bold"))+
  theme(legend.position="none")


acde<-ggarrange(plt0,plt1,plt2,plt3 + rremove("x.text"), 
          labels = c("A", "B","C","D"),
          ncol = 2, nrow = 2)
## Warning: Width not defined. Set with `position_dodge(width = ?)`

## Warning: Width not defined. Set with `position_dodge(width = ?)`

## Warning: Width not defined. Set with `position_dodge(width = ?)`

## Warning: Width not defined. Set with `position_dodge(width = ?)`
acde

## Summary

It appears that the genetic contribution in this sample to BMI and Age of onset of menses is minimal and predomiently through the enviroment. However, we see a large effect of both genetic domience and enviroment on connectivity between 12 and 13. Much more modest differences in the 3 and 6 connectivity with the enviroment.